package cn.wxq.daily.empdailymgforserve.controller;

import cn.wxq.daily.empdailymgforserve.domain.AddTest;
import cn.wxq.daily.empdailymgforserve.model.Result;
import cn.wxq.daily.empdailymgforserve.model.StatusCode;
import cn.wxq.daily.empdailymgforserve.service.AddTestService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@CrossOrigin //跨越处理
@RestController
@RequestMapping("/addTest")
@Api(value = "addTestController|新增测试")
public class addTestController {
    @Autowired
    private AddTestService addTestService;

    @RequestMapping(value = "/addTest", method = RequestMethod.POST)
    @ApiOperation(value = "新增测试")
    public Result addTest(AddTest addTest){
        int row = addTestService.addTest(addTest);
        if (row >0){
            return new Result(true , StatusCode.OK ,"新增成功");
        }else {
            return new Result(false , StatusCode.ERROR ,"新增失败");
        }
    }
}
